<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">
<head >
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
    <style type="text/css">
        body, html,#container {width: 100%;height: 100%;overflow: hidden;margin:0;font-family:"微软雅黑";}
    </style>
    <script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=pectl2zWbVDo5KZUf7Kws1Mm7A6ceD9U"></script>
    <script type="text/javascript" src="/js/common.js"></script>

    <title>地图展示</title>
</head>
<body>
<div id="container"></div>

<script type="text/javascript">
    $.ajax({
        url : '/houseEchart/getPosProjectInfo',
        success : function (data) {
            var map = CustomBaiduMap.getMapObject("container");
            for(let i = 0; i < data.length; i++){
                let projectInfo = data[i];
                let position = projectInfo.position;
                if(position){
                    let positions = position.split(",");
                    CustomBaiduMap.addMarker(map, positions[0], positions[1],generateShowHtml(projectInfo));
                }
            }
        }
    });

    function generateShowHtml(projectInfo) {
        var finalHtml = "<table>";
        finalHtml += "<tr><td>项目名称：</td><td>" + projectInfo.projectName + "</td></tr>"
            + "<tr><td>最小总额：</td><td>" + projectInfo.minTotalPrice + "</td></tr>"
            + "<tr><td>最大总额：</td><td>" + projectInfo.maxTotalPrice + "</td></tr>"
            + "<tr><td>平均总额：</td><td>" + projectInfo.avgTotalPrice + "</td></tr>"
            + "<tr><td>小于100w总数：</td><td>" + projectInfo.enableNum + "</td></tr>"
            + "</table>";
        return finalHtml;
    }



</script>
</body>
</html>